<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>



<html>
  <head>
   
    
    <title></title>
    
				<link href = "css/bootstrap.css" rel = "stylesheet" type = "text/css"/>
				<link href = "css/jquery-ui-1.8.16.custom.css" rel = "stylesheet"/>
				<script type="text/javascript" src="js/jquery.js"></script>
			    <script type="text/javascript" src="js/jqueryui/jquery.ui.core.js"></script>
				<script type="text/javascript" src="js/jqueryui/jquery.ui.widget.js"></script>
				<script type="text/javascript" src="js/jqueryui/jquery.ui.datepicker.js"></script>
				<script type="text/javascript" src="js/jqueryui/jquery.ui.datepicker-zh-CN.js"></script>
				<script type="text/javascript" src="js/jqueryvalidate/jquery.validate.js"></script>
				<script type="text/javascript" src="js/jqueryvalidate/messages_cn.js"></script>
				<script type="text/javascript" src="js/bootstrap.js"></script>
  </head>
  
  <body>
 			<div class="navbar">
				<div class="navbar-inner">
					<div class="container" style="width: auto;">
						<a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						</a>
						<a class="brand" href="#">品竹缘健康生活管</a>
						<div class="nav-collapse">
							<ul class="nav">
								<li class="active">
								<a href="#">添加页</a>
								</li>
								
								
								
								
				
							</ul>
				
						</div>
					</div>
				</div>
			</div>
		<form class ="form-horizontal" action="sales.jspx?task=save" method="post">	
			<fieldset>
				<legend>添加销售记录</legend>
				
				<div class="control-group">
					<label class="control-label" for="input01">日期</label>
					<div class="controls">
					<input id="datepicker" class="input-xlarge" type="text" name="time"/>
					
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="input01">单位</label>
					<div class="controls">
					<input id="input01" class="input-xlarge" type="text" name="companyname"/>
					
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" >导游</label>
					<div class="controls">
					<input id="guide" class="input-xlarge" type="text" name="guidename"  onblur="sendAjax()"/>
					
					</div>
				</div>
				<div class="control-group" id="tells" style="display:none">
					<label class="control-label">电话</label>
					<div class="controls">
					<input  class="input-xlarge" type="text" name="tel"/>
					
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="input01">人数</label>
					<div class="controls">
					<input class="input-xlarge" type="text" name="num"/>
					
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="input01">客源地</label>
					<div class="controls">
					<input id="input01" class="input-xlarge" type="text" name="address"/>
					
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="input01">销售额</label>
					<div class="controls">
					<input id="input01" class="input-xlarge" type="text" name="money"/>
					
					</div>
				</div>
				<div class="form-actions">
					<button class="btn btn-primary" type="submit">保存</button>
					<a class="btn" href="sales.jspx?task=save">取消</a>
				</div>
			</fieldset>
		</form>
		
		<script type="text/javascript">
		
				


		var removeId ="";
		$(document).ready(function(){
			$("#datepicker").datepicker({
	    			changeMonth:true,
	    			option: $.datepicker.regional["zh-CN"]
	    			
	    		
	    	});
	    });
  		var xmlHttp;
  		
  		
  		function createXMLHttpRequest() {
  			if(window.ActiveXObject) {
  		  		
  	  			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  	  		} else {
  	  			
  	  			xmlHttp = new XMLHttpRequest();
  	  		}
  		}
  		
  		function sendAjax(){
  			createXMLHttpRequest();
  			var name = document.getElementById("guide").value;
  			
  			xmlHttp.open("POST","guide.jspx",true);
  			xmlHttp.onreadystatechange = callback;
  			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					xmlHttp.send("name="+name);
  		
  		
  		}
  		
  		function callback(){
  			
  			if(xmlHttp.readyState == 4){
  			
  				if(xmlHttp.status == 200){
  				
  					var result = xmlHttp.responseText;
  					if(result == "ok"){
  						document.getElementById("tells").style.display = "inline";
  					
  					}else if(result == "no"){
  						document.getElementById("tells").style.display = "none";
  					}else{
  						alert("Ajax Error!");
  					}
  				}
  			}
  		}
	  		
	  </script>
  </body>
  
</html>
